<template>
	<view class="loading">
		<fui-animation :duration="500" :animationType="mode" :show="show">
			<fui-loading :isMask="true" maskBgColor ="rgba(0,0,0,0.5)"></fui-loading>
		</fui-animation>
	</view>
</template>

<script>
	export default {
		name:"loading",
		props: {
			loadingShow: {
				type: Boolean,
				default: false,
			},
			loadingText: {
				type: String,
				default: '加载中',
			},
			},
		data() {
			return {
				timer:null,
				show:false,
				mode: ['fade'],
			};
		},
		mounted() {
			
			console.log(this.$props,'$props');
			this.show = this.$props.loadingShow
		},
		beforeDestroy() {
			this.timer && clearTimeout(this.timer)
		},
		watch: {
		    loadingShow: {
		        handler (newName, oldName) {
		            this.show = newName
								this.timer = setTimeout(()=>{
									console.log(newName)
									if(newName){
										this.show = false
										this.$emit('changeLoading')
									}
								},30000)
		        },
		        immediate: true
		    }
		}
	}
</script>

<style lang="scss" scoped>
.loading{
	
}
</style>